package ml.practicum.learn;
/**
 * Interface for learing algorithms using a model in general.
 * But it is also used to validate a model on a dataset
 * and to calculate the out come on a data set
 * <p>
 * So actually it has become more of a connection between the
 * Model, and the dataset. 
 * (if I would rewrite I would write a general connector and seperate
 * the learning algorithm even furter.)
 *</p>
 * 
 * NB. only calculate can be done on a dataset without output.
 * 
 * @author Joscha
 *
 * @param <M> the model type to train and test
 * @param <D> the dataset type to use
 */
public interface Learner<M extends Model<?>,D>{
	/**
	 * Use dataset to train the model
	 * @param model the model to train and test
	 * @param data the dataset to use
	 * @return returns a trained model
	 */
	M learn(M model,D data);
	
	/**
	 * Use dataset to get a dataset of output predicted by the model
	 * @param model the model that performs the calculations
	 * @param data the dataset to use
	 * @return dataset of calculated output
	 */
	D calculate(M model,D data);
	
	/**
	 * Use complete dataset to score the performance of the model
	 * @param model the model to test
	 * @param data the dataset to use
	 * @return value between 0 and 1 correspondingto the percentage of correctly classified output.
	 */
	double test(M model,D data);
}
